Move notebook to /lib
[and.git] / lib / Mi manual de algoritmos / version_maraton_interuniversitaria_2008-2 / src / java / .tex
blob3801b5c4ebdcf0355e2b6d5ba3fc5dd720108b2a
1 % Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
3 {\ttfamily \raggedright {
4 \noindent
5 \mbox{}\textbf{\textcolor{RoyalBlue}{import}}\ java\textcolor{BrickRed}{.}io\textcolor{BrickRed}{.*;} \\
6 \mbox{}\textbf{\textcolor{RoyalBlue}{import}}\ java\textcolor{BrickRed}{.}util\textcolor{BrickRed}{.*;} \\
7 \mbox{}\textbf{\textcolor{Blue}{public}}\ \textbf{\textcolor{Blue}{class}}\ BooleanTree\ \textcolor{Red}{\{}\ \ \ \ \ \ \ \ \textbf{\textcolor{Blue}{public}}\ \textbf{\textcolor{Blue}{static}}\ \textcolor{ForestGreen}{void}\ \textbf{\textcolor{Black}{main}}\textcolor{BrickRed}{(}String\textcolor{BrickRed}{[]}\ args\textcolor{BrickRed}{)}\ \textbf{\textcolor{Blue}{throws}}\ FileNotFoundException\ \textcolor{Red}{\{} \\
8 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ System\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{setIn}}\textcolor{BrickRed}{(}\textbf{\textcolor{Blue}{new}}\ \textbf{\textcolor{Black}{FileInputStream}}\textcolor{BrickRed}{(}\texttt{\textcolor{Red}{"{}tree.in"{}}}\textcolor{BrickRed}{));} \\
9 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ System\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{setOut}}\textcolor{BrickRed}{(}\textbf{\textcolor{Blue}{new}}\ \textbf{\textcolor{Black}{PrintStream}}\textcolor{BrickRed}{(}\texttt{\textcolor{Red}{"{}tree.out"{}}}\textcolor{BrickRed}{));} \\
10 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Scanner\ reader\ \textcolor{BrickRed}{=}\ \textbf{\textcolor{Blue}{new}}\ \textbf{\textcolor{Black}{Scanner}}\textcolor{BrickRed}{(}System\textcolor{BrickRed}{.}in\textcolor{BrickRed}{);} \\
11 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ N\ \textcolor{BrickRed}{=}\ reader\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{nextInt}}\textcolor{BrickRed}{();} \\
12 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ c\ \textcolor{BrickRed}{=}\ \textcolor{Purple}{1}\textcolor{BrickRed}{;}\ c\ \textcolor{BrickRed}{$<$=}\ N\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}c\textcolor{BrickRed}{)}\ \textcolor{Red}{\{} \\
13 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{ForestGreen}{int}\ res\ \textcolor{BrickRed}{=}\ \textcolor{Purple}{100}\textcolor{BrickRed}{;} \\
14 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textbf{\textcolor{Blue}{if}}\ \textcolor{BrickRed}{(}res\ \textcolor{BrickRed}{$<$}\ \textcolor{Purple}{1000}\textcolor{BrickRed}{)} \\
15 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ System\textcolor{BrickRed}{.}out\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{println}}\textcolor{BrickRed}{(}\texttt{\textcolor{Red}{"{}Case\ \#"{}}}\ \textcolor{BrickRed}{+}\ c\ \textcolor{BrickRed}{+}\ \texttt{\textcolor{Red}{"{}:\ "{}}}\ \textcolor{BrickRed}{+}\ res\textcolor{BrickRed}{);} \\
16 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textbf{\textcolor{Blue}{else}} \\
17 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ System\textcolor{BrickRed}{.}out\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{println}}\textcolor{BrickRed}{(}\texttt{\textcolor{Red}{"{}Case\ \#"{}}}\ \textcolor{BrickRed}{+}\ c\ \textcolor{BrickRed}{+}\ \texttt{\textcolor{Red}{"{}:\ IMPOSSIBLE"{}}}\textcolor{BrickRed}{);} \\
18 \mbox{}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{Red}{\}} \\
19 \mbox{}\ \ \ \ \ \ \ \ \textcolor{Red}{\}} \\
20 \mbox{}\textcolor{Red}{\}} \\
22 } \normalfont\normalsize